package web.suzy.oj.controller.msg;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import web.suzy.oj.common.result.ResultBean;
import web.suzy.oj.pojo.vo.SysMsgVO;
import web.suzy.oj.service.msg.NoticeService;

import javax.annotation.Resource;

/**
 * YangSuzy 软件工作室
 * 类名: NoticeController
 * 描述: ---- 待定 -----
 * 功能: 处理用户的系统消息和我的消息
 *
 * @author YangSuzy
 * Date: 2022/11/18 17:34
 */
@RestController
@RequestMapping("/api/msg")
public class NoticeController {
    @Resource
    private NoticeService noticeService;

    /**
     * 方法名: getSysNotice
     * 描述: 获取系统消息
     *
     * @param limit       每页显示数目
     * @param currentPage 当前页
     * @return web.suzy.oj.common.result.ResultBean<com.baomidou.mybatisplus.core.metadata.IPage < web.suzy.oj.pojo.vo.SysMsgVO>>
     * @date 2022/11/18 17:35
     * @auther YangSuzy
     **/
    @RequestMapping(value = "/sys", method = RequestMethod.GET)
    @RequiresAuthentication
    public ResultBean<IPage<SysMsgVO>> getSysNotice(
            @RequestParam(value = "limit", required = false) Integer limit,
            @RequestParam(value = "currentPage", required = false) Integer currentPage) {
        return noticeService.getSysNotice(limit, currentPage);
    }


    /**
     * 方法名: getMineNotice
     * 描述: 获取我的消息
     *
     * @param limit       每页显示数目
     * @param currentPage 当前页
     * @return web.suzy.oj.common.result.ResultBean<com.baomidou.mybatisplus.core.metadata.IPage < web.suzy.oj.pojo.vo.SysMsgVO>>
     * @date 2022/11/18 17:35
     * @auther YangSuzy
     **/
    @RequestMapping(value = "/mine", method = RequestMethod.GET)
    @RequiresAuthentication
    public ResultBean<IPage<SysMsgVO>> getMineNotice(
            @RequestParam(value = "limit", required = false) Integer limit,
            @RequestParam(value = "currentPage", required = false) Integer currentPage) {
        return noticeService.getMineNotice(limit, currentPage);
    }
}
